package com.example.myhook;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.hook.http.HttpServer;
import com.hook.tools.initXposedHook;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;

import cn.missfresh.wsg.SecurityLib;
import de.robv.android.xposed.XposedHelpers;

public class MainActivity extends AppCompatActivity {

    Context context;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        HttpServer httpServer = new HttpServer(7788);
        context = getApplicationContext();
        Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                EditText editText = (EditText) findViewById(R.id.editText);
//                editText.setText("123123");
//                Intent vpnIntent = new Intent();
//                vpnIntent.setAction("android.net.vpn.SETTINGS");
//                startActivity(vpnIntent);
//                Uri uri = Uri.parse("imeituan://www.meituan.com/supermarketfilter/");
                //商超
//                Uri uri = Uri.parse("imeituan://www.meituan.com/takeout/supermarket/flashbuy/home?navigate_type=102620&category_text=%E8%B6%85%E5%B8%82%E4%BE%BF%E5%88%A9&search_category_type=102130&needlocate=1");
//                Uri uri = Uri.parse("imeituan://www.meituan.com/takeout/homepage?g_source=15");
//                Uri uri = Uri.parse("imeituan://www.meituan.com/takeout/supermarket/foods?poi_id=883317079583983&extra=%7B%22source_id%22%3A%222%22%7D");
//                Intent intent = new Intent(Intent.ACTION_VIEW,uri);
//                startActivity(intent);
//                finish();

//                long l = 1614252320114L;
//                String data = "[{\"key\":\"data\",\"value\":\"version9.9.13sessionandroid0.081081627869289631614242820488screen_width1080screen_height2340platformandroiddevtkHOz7k5WdbmQVCU9ARzx2vj0GTK+X2qSXyd4UkBTpJ7S5chrBb78Q/pbQn7ViA6Ejrgz0gohOcZlaKMk0vGBf4blKnX2Wql4mTBJkQKzBTqeHzmx87zdGl0F1R9kQPdlvxnlsTzhVTvSOEouwPFMxNuUO8KYfZd8dvao+Z0K+3Uo=7b22657870496473223a5b223635225d2c22627573696e657373223a226d7279785f616e64726f6964222c22726f6d566572223a223130222c22636f6d6d6f6e223a7b2261646472657373436f6465223a22313130313134222c2273746174696f6e436f6465223a22222c2273637265656e5769647468223a2231303830222c2273657373696f6e223a22616e64726f6964302e303831303831363237383639323839363331363134323432383230343838222c2273637265656e486569676874223a2232333430222c2264656c697665727954797065223a2230222c22616363657373546f6b656e223a22222c2276657273696f6e223a22392e392e3133222c22706c6174666f726d223a22616e64726f6964222c2276616964223a2235373166306138373265643162636631222c2273656c6c65724964223a22363737333531222c2264657669636543656e7465724964223a22222c2261616964223a2233383963643030352d643633612d343064312d616464342d623935306133616333316562222c22616e64726f69644368616e6e656c56616c7565223a22222c2274646b223a22222c22646576746b223a226a627161486d4c7a366c3962526549484d704f58357536492f6b647a704535586c495672364872645a5245676861726d4c4b79317a434e77773868424e3647712b6c796147446e5436442f4455797066345a654d6939756b695245316c2b6b5a4f6238335974567a66395069796d57765430687653674945394d44696b415a41416747503732415854702b79447434564c44692b4a2b494e384867337646346d766670683845334e3164303d222c22616e64726f69644964223a2230383661316331383361613563653537222c226f616964223a2232396236396362343165343362646133222c2262696757617265686f757365223a224d525958544a57227d2c226d6f62696c65223a222d31222c226272616e64223a225869616f6d69204d492039222c226465766963654964223a2230383661316331383361613563653537222c22757365724964223a222d31222c2276657273696f6e223a22392e392e3133222c22706c6174666f726d223a312c227569566572223a225869616f6d692f636570686575732f636570686575733a31302f514b51312e3139303832352e3030322f32302e31312e31383a757365722f72656c656173652d6b657973227d\",\"description\":\"\",\"type\":\"text\",\"enabled\":true}]";
//                try {
//                    String s = SecurityLib.nativeSign(context,l,data.getBytes("UTF-8"));
//                    Toast.makeText(context,"mfSign: "+s,Toast.LENGTH_SHORT).show();
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
            }
        });


//        if (httpServer.isAlive()){
//            Toast.makeText(this,"web服务开启成功,启动端口为7788",Toast.LENGTH_LONG).show();
//        }else{
//            Toast.makeText(this,"web服务开启失败",Toast.LENGTH_LONG).show();
//        }
    }



}
